package demo2;


public class Test {

    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.powerOn();

        Mouse mouse = new Mouse();
        computer.useService(mouse);//向上转型
        System.out.println("=====================");

        KeyBoard keyBoard = new KeyBoard();
        computer.useService(keyBoard);//向上转型
        computer.powerOff();



        /*Computer  computer = new Computer();
        computer.powerOn();

        USB usb1 = new Mouse();
        USB usb2 = new KeyBoard();
        computer.useService(usb1);
        computer.useService(usb2);

        computer.powerOff();

        System.out.println("========================");


        computer.powerOn();
        Mouse mouse = new Mouse();
        mouse.openDevice();
        mouse.click();
        mouse.closeDevice();

        KeyBoard keyBoard = new KeyBoard();
        keyBoard.openDevice();
        keyBoard.input();
        keyBoard.closeDevice();
        computer.powerOff();*/
    }


}
